package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.*;
import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
public class TeacherBaseInfoController {
    @Autowired
    private CourseTeacherService courseTeacherService;

    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacherDto> courseTeacherList(@PathVariable Long courseId){
        return courseTeacherService.courseTeacherList(courseId);
    }

    @PostMapping("/courseTeacher")
    @ApiOperation("添加老师/修改老师")
    public CourseTeacherDto addAndModifyCourseTeacher(@RequestBody CourseTeacherDto courseDto){
        Long compangId=1232141425L;
        return courseTeacherService.addAndModifyCourseTeacher(compangId,courseDto);
    }

    @PutMapping("/courseTeacher")
    @ApiOperation("修改教师")
    public CourseTeacherDto modifyCourseTeacher(@RequestBody CourseTeacher dto){
        Long compangId=1232141425L;
        return courseTeacherService.modifyCourseTeacher(compangId, dto);
    }

    @DeleteMapping("/courseTeacher/course/{courseId}/{teacherId}")
    @ApiOperation("删除教师")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long teacherId){
        Long compangId=1232141425L;
        courseTeacherService.deleteCourseTeacher(compangId,courseId,teacherId);
    }


}
